
const { ccclass, property } = cc._decorator;

import MeiTong from "./MeiTong";
import ShuangYanPi from "./ShuangYanPi";
@ccclass
export default class StepFour extends cc.Component {
    //触摸区域
    @property(cc.Node)
    bg: cc.Node = null;
    //第四步
    //美瞳
    @property(MeiTong)
    MeiTong: MeiTong = null;
    //夹双眼皮
    @property(ShuangYanPi)
    ShuangYanPi: ShuangYanPi = null;

    _point = 1;
    onLoad() {
        this.bg.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
        this.bg.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
    };

    onTouchStart(event) {
        switch (this._point) {
            case 1:
                this.MeiTong._touchStart(event);
                break;
            case 2:
                this.ShuangYanPi._touchStart(event);
                break;
        }
    };

    onTouchMove(event) {
        switch (this._point) {
            case 1:
                this.MeiTong._touchMove(event);
                break;
            case 2:
                this.ShuangYanPi._touchMove(event);
                break;
        }
    };


    //更新步骤
    updatePoint(point: number) {
        this._point = point;
        this.MeiTong.node.active = point == 1;
        this.ShuangYanPi.node.active = point == 2;
        switch (point) {
            case 1:
                this.MeiTong.initData();
                break;
            case 2:
                this.ShuangYanPi.initData();
                break;
        }
    };


}
